// yb_mingpian/pages/ruzhu/jiesuan.js
var t = getApp(),
  a = t.requirejs("core"),
  s = t.requirejs("wxParse/wxParse");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    discript: '',
    goodsrate: '',
    all_sy:'',
    minmoney:'',
    tx_money: '',
    user_name: '',
    bank_name:'',
    bank_branch: '',
    bank_id: '',
    tx_finish:'',
    tx_stay:'',
    txing_money:'',
  },
  Inputtx_money(e){
    this.setData({
      tx_money: e.detail.value
    })
},
Inputbank_name(e){
  this.setData({
    bank_name: e.detail.value
  })
},
Inputbank_branch(e){
  this.setData({
    bank_branch: e.detail.value
  })
},
Inputbank_id(e){
  this.setData({
    bank_id: e.detail.value
  })
},
Inputuser_name(e){
  this.setData({
    user_name: e.detail.value
  })
},
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getdata()
  },
  getdata: function(){
    var o = this
     a.get("Card/MyWallet", {
        uid: getApp().getCache("userinfo").uid,
      }, function (res) {
        console.log(res)
        o.setData({
          discript : res.discript
        })
        o.setData({
          goodsrate : res.goodsrate
        })
        o.setData({
          all_sy : res.all_sy
        })
        o.setData({
          minmoney : res.minmoney
        })
        o.setData({
          tx_finish : res.tx_finish
        })
        o.setData({
          tx_stay : res.tx_stay
        })
        o.setData({
          txing_money : res.txing_money
        })
      })
      
  },
  submit: function(){
    var o = this
    // console.log(o.data.tx_money)
    // console.log(o.data.user_name)
    // console.log(o.data.bank_name)
    // console.log(o.data.bank_branch)
    // console.log(o.data.bank_id)
    
     a.get("Card/MoneyApply", {
        uid: getApp().getCache("userinfo").uid,
        tx_money: o.data.tx_money,
        user_name: o.data.user_name,
        bank_name: o.data.bank_name,
        bank_branch: o.data.bank_branch,
        bank_id: o.data.bank_id,
      }, function (res) {
        console.log(res)
        wx.showToast({
          title: res.info,
          icon: 'none',
          duration: 2000
        })
      })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})